{% extends 'base.html' %}

{% block title %}重置密码 - Django RBAC 项目{% endblock %}

{% block content %}
<div class="min-h-screen bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8">
    <div class="sm:mx-auto sm:w-full sm:max-w-md">
        <h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
            重置密码
        </h2>
        <p class="mt-2 text-center text-sm text-gray-600">
            请输入您的新密码
        </p>
    </div>

    <div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
        <div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
            <form class="space-y-6" method="POST">
                {% csrf_token %}
                {% if form.non_field_errors %}
                    <div class="rounded-md bg-red-50 p-4">
                        <div class="flex">
                            <div class="flex-shrink-0">
                                <svg class="h-5 w-5 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
                                </svg>
                            </div>
                            <div class="ml-3">
                                <h3 class="text-sm font-medium text-red-800">
                                    表单验证错误
                                </h3>
                                <div class="mt-2 text-sm text-red-700">
                                    <ul class="list-disc pl-5 space-y-1">
                                        {% for error in form.non_field_errors %}
                                            <li>{{ error }}</li>
                                        {% endfor %}
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                {% endif %}

                <div>
                    <label for="{{ form.password.id_for_label }}" class="block text-sm font-medium text-gray-700">
                        新密码
                    </label>
                    <div class="mt-1">
                        {{ form.password }}
                        {% if form.password.errors %}
                            {% for error in form.password.errors %}
                                <p class="mt-2 text-sm text-red-600">{{ error }}</p>
                            {% endfor %}
                        {% endif %}
                    </div>
                </div>

                <div>
                    <label for="{{ form.confirm_password.id_for_label }}" class="block text-sm font-medium text-gray-700">
                        确认新密码
                    </label>
                    <div class="mt-1">
                        {{ form.confirm_password }}
                        {% if form.confirm_password.errors %}
                            {% for error in form.confirm_password.errors %}
                                <p class="mt-2 text-sm text-red-600">{{ error }}</p>
                            {% endfor %}
                        {% endif %}
                    </div>
                </div>

                <div>
                    <button type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
                        重置密码
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}

